/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * <p>Project: javase - Stream3
 * <p>Powered by webrx On 2021-12-22 15:54:23
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream3 {
    public static void main(String[] args) {

        //DoubleStream.generate(Math::random).limit(10).forEach(System.out::println);
        var ii = IntStream.rangeClosed(1, 6);
        System.out.println(1 * 2 * 3 * 4 * 5 * 6);
        //System.out.println(ii.reduce((a, b) -> a * b).getAsInt());
        System.out.println(ii.reduce(1, (a, b) -> a * b));

        var ss = Stream.of("java", "javascript", "html");
        //System.out.println(ss.reduce("", String::concat));
        System.out.println(ss.reduce(String::concat).get());
    }
}
